import { combineReducers } from 'redux';
import { all, fork } from 'redux-saga/effects';
import { LoanRecycleStatistics, loanRecycleStatisticsState, loanRecycleStatisticsSaga } from './LoanRecycleStatistics';
import { TdRefuseStatistics, tdRefuseStatisticsState, tdRefuseStatisticsSaga } from './TdRefuseStatistics';
import { AllDataStatistics, allDataStatisticsState, allDataStatisticsSaga } from './AllDataStatistics';
import { OverdueStatistics, overdueStatisticsState, overdueStatisticsSaga } from './OverdueStatistics';
import { AtoSStatistics, atosStatisticsState, atosStatisticsSaga } from './AtoSStatistics';
import { SumStatistics, sumStatisticsState, sumStatisticsSaga } from './SumStatistics';
import { Registrations, registrationsState, registrationsSaga } from './Registrations';
import { RegS1, regS1istrationsState, regS1istrationsSaga } from './RegS1';
import { overdueDistributionS1, overdueDistributionS1State, overdueDistributionS1Saga } from './overdueDistributionS1';

// 
import { BlackReport, blackReportState, blackReportSaga } from './BlackReport';
import { PayReport, payReportState, payReportSaga } from './PayReport';
import { ChannelLdzhReport, channelLdzhReportState, channelLdzhReportSaga } from './ChannelLdzhReport';
import { ChannelYqlZhlReport, channelYqlZhlReportState, channelYqlZhlReportSaga } from './ChannelYqlZhlReport';

const businessStatisticsRoutes  = [
    { path: '/loanRecycleStatistics', component: LoanRecycleStatistics },
    { path: '/tdRefuseStatistics', component: TdRefuseStatistics },
    { path: '/allDataStatistics', component: AllDataStatistics },
    { path: '/overdueStatistics', component: OverdueStatistics },
    { path: '/atoSStatistics', component: AtoSStatistics },
    { path: '/sumStatistics', component: SumStatistics},
    { path: '/registrations', component: Registrations},
    { path: '/regS1', component: RegS1},
    { path: '/overdueDistributionS1', component: overdueDistributionS1},

    // 
    { path: '/blackReport', component: BlackReport},
    { path: '/payReport', component: PayReport},
    { path: '/channelLdzhReport', component: ChannelLdzhReport},
    { path: '/channelYqlZhlReport', component: ChannelYqlZhlReport},
]

const businessStatisticsMenuList = [
    {
        title: '业务统计',
        key: '/businessStatistics',
        icon: 'code-o',
        children: [
            {
                title: '回款统计',
                key: '/loanRecycleStatistics',
                icon: 'dot-chart'
            },
            {
                title: '被拒原因统计',
                key: '/tdRefuseStatistics',
                icon: 'question-circle-o'
            },
            {
                title: '各项指标汇总',
                key: '/allDataStatistics',
                icon: 'line-chart'
            },
            {
                title: '逾期统计',
                key: '/overdueStatistics',
                icon: 'hourglass'
            },
            {
                title: 'AtoS统计',
                key: '/atoSStatistics',
                icon: 'hourglass'
            },
            {
                title: '汇总统计',
                key: '/sumStatistics',
                icon: 'hourglass'
            },
            {
                title: '日转化率统计',
                key: '/registrations',
                icon: 'hourglass'
            },
            {
                title: '借款次数统计',
                key: '/regS1',
                icon: 'line-chart'
            },
            {
                title: '借款次数统计',
                key: '/overdueDistributionS1',
                icon: 'line-chart'
            },
            // 
            {
                title: '黑名单统计',
                key: '/blackReport',
                icon: 'line-chart'
            },
            {
                title: '放款报表',
                key: '/payReport',
                icon: 'line-chart'
            },
            {
                title: '渠道漏斗转化报表',
                key: '/channelLdzhReport',
                icon: 'line-chart'
            },
            {
                title: '渠道逾期率及转化率',
                key: '/channelYqlZhlReport',
                icon: 'line-chart'
            },
        ]
    }
]
const businessStatisticsState = combineReducers({
    loanRecycleStatisticsState,
    tdRefuseStatisticsState,
    allDataStatisticsState,
    overdueStatisticsState,
    atosStatisticsState,
    sumStatisticsState,
    registrationsState,
    regS1istrationsState,
    overdueDistributionS1State,

    // 
    blackReportState,
    payReportState,
    channelLdzhReportState,
    channelYqlZhlReportState
})

function* businessStatisticsSaga() {
    yield all([
        fork(loanRecycleStatisticsSaga),
        fork(tdRefuseStatisticsSaga),
        fork(allDataStatisticsSaga),
        fork(overdueStatisticsSaga),
        fork(atosStatisticsSaga),
        fork(sumStatisticsSaga),
        fork(registrationsSaga),
        fork(regS1istrationsSaga),
        fork(overdueDistributionS1Saga),

        // 
        fork(blackReportSaga),
        fork(payReportSaga),
        fork(channelLdzhReportSaga),
        fork(channelYqlZhlReportSaga)
    ])
}

export { businessStatisticsMenuList, businessStatisticsRoutes, businessStatisticsSaga, businessStatisticsState };